﻿@model List<CMP.ERP.Model.PandianList>
@{
    Layout = null;
}
@Html.Action("Account_Show", "Account");
    <div class="content">
        <div class="right" id="mainFrame">
            <div class="right_cont">

                <div id="middle">

                    <div class="Switch"></div>
                    <script type="text/javascript">
                        $(document).ready(function (e) {
                            $(".Switch").click(function () {
                                $(".left").toggle();

                            });
                        });
                    </script>
                    <div class="right" id="mainFrame">
                        <div class="right_cont">
                            <ul class="breadcrumb">
                                当前位置：
                                <a href="/Home/Index">首页</a>
                                <span class="divider">/</span>
                                盘点单
                            </ul>
                            <div class="title_right"><strong>盘点单</strong></div>
                            <div style="width:100%; margin:auto">
                                <div>
                                    <button onclick="del()" role="button" type="button" class="btn btn-default" data-toggle="modal"><span class="icon-remove"></span>&nbsp;批量删除</button>
                                </div>
                                <div style="margin-top:20px;">
                                    <table class="table  table-hover table-bordered table-striped">
                                        <thead>
                                            <tr>
                                                <th><input id="Checkbox1" onclick="s()" type="checkbox" />全选</th>
                                                <th>盘点单编号</th>
                                                <th>商品名称</th>
                                                <th>仓库名称</th>
                                                <th>盘点前数量</th>
                                                <th>盈亏数量</th>
                                                <th>盘点后数量</th>
                                                <th>备注</th>

                                            </tr>
                                        </thead>
                                        <tbody>
                                            @foreach (var item in Model)
                                            {
                                                <tr>
                                                    <td><input onclick="ss()" name="ck" value="@item.PandianId" type="checkbox" /></td>
                                                    <td>@item.PandianId</td>
                                                    <td>@item.ShangpinName</td>
                                                    <td>@item.CangkuName</td>
                                                    <td>@item.PandianqianNum</td>
                                                    <td>@(item.PandianqianNum - item.PandianhouNum)</td>
                                                    <td>@item.PandianhouNum</td>
                                                    <th>
                                                        <a href="/Blurb/DelComodity/@item.PandianId" style="color:black" onclick="return confirm('好好考虑一下吧！')"><span class="icon-remove"></span>删除</a>
                                                    </th>

                                                </tr>
                                            }
                                        </tbody>
                                    </table>
                                </div>
                            </div>

                        </div>
                    </div>
                </div>

            </div>
        </div>
    </div>

    <script type="text/javascript">
        $("[rel=tooltip]").tooltip();
        $(function () {
            $('.demo-cancel-click').click(function () { return false; });
        });
        function fun() {
            location.href = '/Home/Index';
        }
        function s() {
            var cklist = $("[name=ck]");
            var isck = $("#Checkbox1").attr("checked");
            if (isck == "checked") {
                $(cklist).attr("checked", "checked");
            }
            else {
                $(cklist).removeAttr("checked");
            }
        }
        function ss() {
            var cklist = $("[name=ck]");
            if ($("[name=ck]:checked").length == cklist.length) {
                $("#Checkbox1").attr("checked", "checked");
            }
            else {
                $("#Checkbox1").removeAttr("checked");
            }
        }
        function del() {
            var cklist = $("[name=ck]:checked");
            var newslist = "";
            $(cklist).each(function (i, obj) {
                if (newslist.length > 0) {
                    newslist += ",";
                }
                newslist += $(obj).val();
            });
            $.ajax({
                url: "/Pandiandan/Del",
                data: { id: newslist },
                type: "post",
                success: function (shan) {
                    if (shan > "0") {
                        alert("删除成功");
                        location.href = "/Pandiandan/Index";
                    }
                    else {
                        alert("删除失败");
                    }
                }
            })
        }
    </script>
</body>
